export namespace main {
	
	export class ApiResponse {
	    ruleName: string;
	    homeAddr: string;
	    ipAddr: string;
	
	    static createFrom(source: any = {}) {
	        return new ApiResponse(source);
	    }
	
	    constructor(source: any = {}) {
	        if ('string' === typeof source) source = JSON.parse(source);
	        this.ruleName = source["ruleName"];
	        this.homeAddr = source["homeAddr"];
	        this.ipAddr = source["ipAddr"];
	    }
	}
	export class RuleInfo {
	    ruleName: string;
	    homeAddr: string;
	    network: string;
	    localport: number;
	
	    static createFrom(source: any = {}) {
	        return new RuleInfo(source);
	    }
	
	    constructor(source: any = {}) {
	        if ('string' === typeof source) source = JSON.parse(source);
	        this.ruleName = source["ruleName"];
	        this.homeAddr = source["homeAddr"];
	        this.network = source["network"];
	        this.localport = source["localport"];
	    }
	}
	export class Config {
	    API_URL: string;
	    ruleInfo: RuleInfo[];
	
	    static createFrom(source: any = {}) {
	        return new Config(source);
	    }
	
	    constructor(source: any = {}) {
	        if ('string' === typeof source) source = JSON.parse(source);
	        this.API_URL = source["API_URL"];
	        this.ruleInfo = this.convertValues(source["ruleInfo"], RuleInfo);
	    }
	
		convertValues(a: any, classs: any, asMap: boolean = false): any {
		    if (!a) {
		        return a;
		    }
		    if (a.slice && a.map) {
		        return (a as any[]).map(elem => this.convertValues(elem, classs));
		    } else if ("object" === typeof a) {
		        if (asMap) {
		            for (const key of Object.keys(a)) {
		                a[key] = new classs(a[key]);
		            }
		            return a;
		        }
		        return new classs(a);
		    }
		    return a;
		}
	}

}

